package leetcode.D300.T263;

/**
 * @File Info: leetcode -- <Solution>
 * @Author: 18362
 * @Create: 2022-03-15 10:28:28 星期二
 */

class Solution {
    public boolean isUgly(int n) {
        if (n <= 0)
            return false;
        int[] factor = new int[] {2, 3, 5};
        for(int i=0; i<3; ++i) {
            while(n % factor[i] == 0) {
                n /= factor[i];
            }
        }
        return n <= 1;
    }
}